package myapp.mvc_pattern;

import java.io.Serializable;
import java.util.Observable;

public class Item extends Observable implements Serializable {

	private String vName;
	private int preis;
	private boolean paid = false;
	
	public Item (String n, int p) {
		this.vName = n;
		this.preis = p;
	}
	
	public void setStatePaid() {
		paid = true;
		setChanged();
		notifyObservers();
	}
	
	
	public Boolean getState () {
		return paid;
	}
	
	public Integer getPrize () {
		return this.preis;
	}

	@Override
	public String toString() {
		String pay = "";
		if (paid == false) {
			pay = "Offen";
		} else {
			pay = "Bezahlt";
		}
		return vName + " \t" + preis +" Euro\t" + pay;
//		return "Item [vName=" + vName + ", preis=" + preis + ", paid=" + paid
//				+ "]";
	}

	
}
